<template>
  <div>
    <el-card class="card1">
      <el-form :model="form" :inline="true" size="small">
        <el-form-item label="城市">
          <el-select v-if="showTree"  class="main-select-tree" ref="selectTree"
                     v-model="found ? form.county : form.eleAreaCode">
            <el-option v-for="item in  treeData" :key="item.value" :label="item.label"
                       :value="item.value" style="display: none;" />
            <el-tree class="main-select-el-tree" ref="selecteltree" :data="treeData" node-key="areaId" highlight-current
                      @node-click="handleNodeClick"
                     :expand-on-click-node="expandOnClickNode" />
          </el-select>
        </el-form-item>
        <el-form-item label="使用单位" label-width="100px">
          <el-input v-model="form.useOrgName" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="维保单位" label-width="100px">
          <el-input v-model="form.maintOrgName" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="设备注册代码" label-width="100px">
          <el-input v-model="form.eleCode" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="963333识别码" >
          <el-input v-model="form.num96333" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="出厂编号" label-width="100px">
          <el-input v-model="form.factoryNo" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="区域管理单位" label-width="100px" prop="manageAreaOrgId">
          <el-select v-if="selectShow" v-model="form.manageAreaOrgId" placeholder="请选择" size='small' filterable  clearable @change="areaChange">
            <el-option v-for="item in manangeAreaOrgList" :key="item.id" :label="item.orgName" :value="item.id">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="直属管理单位" label-width="100px" prop="manageOrgId">
          <el-select v-if="selectShow" v-model="form.manageOrgId" placeholder="请选择" size='small' filterable  clearable>
            <el-option v-for="item in manangeOrgList" :key="item.id" :label="item.orgName" :value="item.id">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item style="margin-left:30px">
          <el-button type="primary" @click="gettableData" size="small">查询</el-button>
          <el-button @click="onexport" size="small">导出</el-button>
        </el-form-item>
      </el-form>
    </el-card>
    <el-card class="card3">
      <div slot="header" class="clearfix">
        <div style="display: flex;justify-content: space-between;align-items: center;">
          <p>共<span style="color:red;margin:0 5px">{{maintEleTotal}}</span>台电梯</p>

          <el-button style="float: right" @click="eleEdit" type="danger" size="small" v-show="vshow">批量修改电梯信息</el-button>
          <el-button style="float: right" @click="eleManage" type="danger" size="small" v-show="vshow">修改管理单位</el-button>
          <el-button size="small" type="primary" @click="addClick" v-show="vshow">添加</el-button>
          <el-button size="small" type="primary" @click="download" v-show="vshow">模板下载</el-button>
          <el-button size="small" type="primary" @click="uploadClick" v-show="vshow">模版导入</el-button>
<!--          <el-button size="small" type="primary" @click="upload96333Click" v-show="vshow">导入96333</el-button>-->
<!--          <el-button size="small" type="primary" @click="uploadCheckClick" v-show="vshow">导入监察设备</el-button>-->
        </div>
      </div>
      <div class="text">
        <el-table :data="tableData" style="width: 100%" :header-cell-style="{
      fontWeight:800}" @selection-change="handleSelectionChange">
          <el-table-column type="selection" width="55" align="center">
          </el-table-column>
          <el-table-column type="index" label="序号" fixed width="60">
          </el-table-column>
          <el-table-column label="设备注册代码" fixed prop="eleCode" width="200">
           <template slot-scope="scope">
              <el-button type='text' @click="infoClick(scope.row.eleCode)">
                {{scope.row.eleCode}}
              </el-button>
            </template>
          </el-table-column>
          <el-table-column prop="num963333" fixed label="识别码" width="80">
          </el-table-column>
          <el-table-column prop="factoryNo" fixed label="出厂编号" width="200">
          </el-table-column>
          <el-table-column prop="maintOrgName" label="维保单位名称" width="200">
          </el-table-column>
          <el-table-column prop="eleStatus" label="设备状态">
          </el-table-column>
          <el-table-column prop="eleCertNo" width="150" label="登记证号">
          </el-table-column>
          <el-table-column prop="manageOrgName" label="管理单位" width="200">
          </el-table-column>
          <el-table-column prop="useOrgName" label="使用单位" width="200">
          </el-table-column>
          <el-table-column prop="eleUseCommunity" label="设备安装地址" width="200">
          </el-table-column>
          <el-table-column prop="date" label="操作">
            <template slot-scope="scope">
              <el-button @click="editClick(scope.row)" type="text" size="small">编辑</el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="pagination.pageNum"
          :page-size="pagination.pageSize" :page-sizes="[10, 20, 50]" layout="total, sizes, prev, pager, next, jumper" :total="pagination.pageTotal">
        </el-pagination>
      </div>
    </el-card>

    <el-dialog title="修改电梯管理单位" :visible.sync="dialogVisible" width="30%">
      <el-form :model="orgForm" :inline="true" size="small">
        <el-form-item label="管理单位" label-width="100px" prop="manageOrgId">
          <el-select v-model="orgForm.manageOrgId" placeholder="请选择" size='small' filterable  clearable>
            <el-option v-for="item in manangeOrgList" :key="item.id" :label="item.orgName" :value="item.id">
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="getXiugai">确 定</el-button>
      </span>
    </el-dialog>

    <el-dialog  title="批量修改电梯信息" :visible.sync="eledialogVisible" width="30%" :close-on-click-modal="false"
               element-loading-text="批量修改电梯信息"
               element-loading-spinner="el-icon-loading"
               element-loading-background="rgba(0, 0, 0, 0.4)"
               element-loading-custom-class="boxstyle"
               v-loading.fullscreen.lock="editfullscreenLoading">
      <el-form :model="eleForm" :inline="true" size="small">
        <el-form-item label="维保单位" label-width="100px" prop="maintOrgId">
          <el-select v-if="plxgShow" v-model="eleForm.maintOrgId"
                     placeholder="请选择"
                     size='small'
                     filterable  clearable
                     remote
                     :remote-method="getMaintOrgList">
            <el-option v-for="item in maintOrgList" :key="item.id" :label="item.orgName" :value="item.id">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item v-if="plxgShow" label="使用单位" label-width="100px" prop="useOrgId">
          <el-select v-model="eleForm.useOrgId" placeholder="请选择" size='small'
                     filterable
                     clearable
                     remote
                     :remote-method="getUseOrgList"
          >
            <el-option v-for="item in useOrgList" :key="item.id" :label="item.orgName" :value="item.id">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="地理信息(经纬度[30.23,114.25])：">
          <el-input v-model="eleForm.eleLocation"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="eledialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="xiugaiEle">确 定</el-button>
      </span>
    </el-dialog>

    <el-dialog title="数据导入" :visible.sync="importDataVisible" width="600px" :close-on-click-modal="false"
               element-loading-text="数据导入中"
               element-loading-spinner="el-icon-loading"
               element-loading-background="rgba(0, 0, 0, 0.4)"
               element-loading-custom-class="boxstyle"
               v-loading.fullscreen.lock="fullscreenLoading">
      <el-form :model="formData" label-width="80px">
        <el-form-item label="导入文件" prop="file">
          <el-upload
            class="upload-demo"
            drag
            accept=".xlsx"
            :auto-upload="false"
            :file-list="fileList"
            :limit="1"
            action=""
            :on-change="changeUploadFile"
          >
            <i class="el-icon-upload" />
            <div class="el-upload__text">
              将文件拖到此处，或<em>点击上传</em>
            </div>
          </el-upload>
        </el-form-item>
        <el-form-item style="text-align: center;">
          <el-button size="small" @click="importCancel">
            取消
          </el-button>
          <el-button type="primary" size="small" @click="importOK">
            确定
          </el-button>
        </el-form-item>
      </el-form>
    </el-dialog>

    <el-dialog title="963333导入" :visible.sync="import96333Visible" width="600px" :close-on-click-modal="false"
               element-loading-text="数据导入中"
               element-loading-spinner="el-icon-loading"
               element-loading-background="rgba(0, 0, 0, 0.4)"
               element-loading-custom-class="boxstyle"
               v-loading.fullscreen.lock="fullscreen96333Loading">
      <el-form :model="form96333Data" label-width="80px">
        <el-form-item label="导入文件" prop="file">
          <el-uploadmaintOrgList
            class="upload-demo"
            drag
            accept=".xlsx,.xls"
            :auto-upload="false"
            :file-list="file96333List"
            :limit="1"
            action=""
            :on-change="change96333UploadFile"
          >
            <i class="el-icon-upload" />
            <div class="el-upload__text">
              将文件拖到此处，或<em>点击上传</em>
            </div>
          </el-uploadmaintOrgList>
        </el-form-item>
        <el-form-item style="text-align: center;">
          <el-button size="small" @click="import96333Cancel">
            取消
          </el-button>
          <el-button type="primary" size="small" @click="import96333OK">
            确定
          </el-button>
        </el-form-item>
      </el-form>
    </el-dialog>

    <el-dialog title="监察设备导入" :visible.sync="importCheckVisible" width="600px" :close-on-click-modal="false"
               element-loading-text="数据导入中"
               element-loading-spinner="el-icon-loading"
               element-loading-background="rgba(0, 0, 0, 0.4)"
               element-loading-custom-class="boxstyle"
               v-loading.fullscreen.lock="fullscreenCheckLoading">
      <el-form :model="formCheckData" label-width="80px">
        <el-form-item label="导入文件" prop="file">
          <el-upload
            class="upload-demo"
            drag
            accept=".xlsx,.xls"
            :auto-upload="false"
            :file-list="fileCheckList"
            :limit="1"
            action=""
            :on-change="changeCheckUploadFile"
          >
            <i class="el-icon-upload" />
            <div class="el-upload__text">
              将文件拖到此处，或<em>点击上传</em>
            </div>
          </el-upload>
        </el-form-item>
        <el-form-item style="text-align: center;">
          <el-button size="small" @click="importCheckCancel">
            取消
          </el-button>
          <el-button type="primary" size="small" @click="importCheckOK">
            确定
          </el-button>
        </el-form-item>
      </el-form>
    </el-dialog>

    <LiftDailog ref="dailog" />
    <LeftDetails ref="LeftDetails" />
  </div>
</template>

<script>
import util from '@/libs/util'
import { getAdminPublicEleList, getAdminPublicEleTotal, getAdminManageOrgInfoList, getAdminManageAreaOrgInfoList } from '@/api/elevator'
import LeftDetails from '@/views/elevator/components/leftdetails.vue'
import LiftDailog from '@/views/maint-admin/ele/components/liftdetail.vue'
import { getUploadFile } from '@/api/public'
import {editEleListManageOrg,editEleByCodes} from "@/api/elevator";
import {getadminOrgInfoList,getadminOrgInfoListNew} from "@/api/useOrgManage";
import {getCityTree} from "@/api/tool";
import excel from '@/views/export/excel.js'
export default {
  components: {
    LeftDetails,
    LiftDailog
  },
  data () {
    return {
      selectShow:false,
      plxgShow:false,
      showTree:false,
      maintOrgList:[

      ],
      useOrgList:[],
      treeData: [],
      expandOnClickNode: true,
      found: false,
      maintOrgId:'',
      vshow:true,
      maintEleTotal:0,
      dialogVisible: false,
      eledialogVisible: false,
      pagination: {
        pageTotal: 0,
        pageSize: 10,
        pageNum: 1,
      },
      eleTotal:0,
      useOrgNum:0,
      obj:{},
      importDataVisible:false,
      import96333Visible:false,
      importCheckVisible:false,
      formData:{
        disposeId:'',
        file:'',
        type:''
      },
      form96333Data:{
        disposeId:'',
        file:'',
        type:''
      },
      formCheckData:{
        disposeId:'',
        file:'',
        type:''
      },
      option: [
        {
          label: "宜昌",
          value: "4205%"
        },
        {
          label: "恩施",
          value: "4228%"
        },
        {
          label: "荆州",
          value: "4210%"
        },
        {
          label: "神农架",
          value: "4290%"
        },
        {
          label: "十堰",
          value: "4203%"
        }
      ],
      eleAreaCode:'',
      tableData: [],
      manangeOrgList:[],
      manangeAreaOrgList:[],
      form: {
      },
      orgForm:{},
      eleForm:{
        maintOrgId:null,
        useOrgId:null,
      },
      fileList: [],
      file96333List: [],
      fileCheckList: [],
      filePath: '',

      multipleSelection: [],
      fullscreenLoading: false,
      fullscreen96333Loading: false,
      fullscreenCheckLoading: false,
      editfullscreenLoading:false,
      isOverdueArr: {
        0: '否',
        1: '是'
      }
    }
  },
  mounted () {
    this.getMaintOrgList()
    this.getUseOrgList()
    this.getManangeAreaOrgList()
    this.form.manageAreaOrgId=this.$route.query.manageId
    if(!this.form.manageAreaOrgId){
      this.form.manageAreaOrgId=''
    }
    this.gettableData()
    this.getManangeOrgList()
    this.getCityTree()
  },
  methods: {
    getCityTree() {
      getCityTree({ "options": this.option }).then(res => {
        if (res.data.code == '200') {
          const excluded = ["潜江", "天门", "仙桃", "东沙"]
          this.treeData = res.data.data.filter(e => {
            return !excluded.some(value => e.label.includes(value));
          });
          this.treeData.unshift({
            areaId: "0",
            areaLevel: "2",
            label: "全部",
            value: "",
          })
        }
        this.showTree = true;
      })
    },
    changeEleCountys(value) {
      this.treeData.map(e => {
        if (e.children != null) {
          e.children.map(j => {
            if (j.value == value) {
              this.found = true
              this.children = e.children
            }
          })
        }
      })
      this.form.county = value;
    },
    changeEleAreaCode(value) {
      this.form.county = "";
      //根据选项，调整县级选择
      // this.getCounty(value);
      this.form.eleAreaCode = value;
      this.found = false
    },
    handleNodeClick(data) {
      debugger
      let value = data.value
      let level = data.areaLevel
      if (level == 2) {
        this.changeEleAreaCode(value)
      } else {
        this.changeEleCountys(value)
      }
    },
    download(){
      window.open("/static/xlsx/电梯信息模板.xlsx")
    },
    uploadClick(){/**上传点击事件 */
    this.importDataVisible=true
    },
    changeUploadFile(file,fileList){
      for(let i=0;i<fileList.length;i+=1){
        this.fileList.push(fileList[i].raw)
      }
    },
    importOK(){/**导入确定 */
    this.fullscreenLoading = true;
    let param = new FormData()
      param.append('file', this.fileList[0])
      util.http.post(this.$util.baseIP+'/biz-maint/maint-admin/eleInfo/import',param,{
        headers: {
          'Content-Type': 'multipart/form-data'
        },
        transformRequest: [
          function (d) {
            console.log(d)
            return d
          }
        ]
      }).then(res=>{

        this.fullscreenLoading = false;

        this.formData={
          disposeId:'',
          file:'',
          type:''
        }
        this.fileList=[]
        this.importDataVisible=false
        if(res.data.data.length>0){
          const params = {
            title: ['序号','设备注册代码', '设备状态', '使用单位', '制造单位', '维保单位', '设备类型',"错误信息"],
            key: ['index','eleCode', 'eleStatus', 'useOrgName', 'eleManufacturerName', 'maintOrgName', 'eleTypeName', 'remark'],
            data: res.data.data, // 数据源
            autoWidth: true, //autoWidth等于true，那么列的宽度会适应那一列最长的值
            filename: '错误列表'
          }
          excel.exportArrayToExcel(params)
        }
        this.gettableData()
      })
    },
    importCancel(){/**导入取消 */
    this.formData={
      disposeId:'',
      file:'',
      type:''
    }
      this.fileList=[]
      this.importDataVisible=false
    },

    upload96333Click(){/**上传点击事件 */
    this.import96333Visible=true
    },
    change96333UploadFile(file,fileList){
      for(let i=0;i<fileList.length;i+=1){
        this.file96333List.push(fileList[i].raw)
      }
    },
    import96333OK(){/**导入确定 */
    this.fullscreen96333Loading = true;
      let param = new FormData()
      param.append('file', this.file96333List[0])
      util.http.post(this.$util.baseIP+'/biz-maint/maint-admin/eleInfo/import-ele',param,{
        headers: {
          'Content-Type': 'multipart/form-data'
        },
        transformRequest: [
          function (d) {
            console.log(d)
            return d
          }
        ]
      }).then(res=>{

        this.fullscreen96333Loading = false;

        this.form96333Data={
          disposeId:'',
          file:'',
          type:''
        }
        this.file96333List=[]
        this.import96333Visible=false
        if(res.data.data.length>0){
          const params = {
            title: ['电梯识别码','电梯注册码',"错误信息"],
            key: ['eleFlag','eleCode',  'remark'],
            data: res.data.data, // 数据源
            autoWidth: true, //autoWidth等于true，那么列的宽度会适应那一列最长的值
            filename: '错误列表'
          }
          excel.exportArrayToExcel(params)
        }
        this.gettableData()
      })
    },
    import96333Cancel(){/**导入取消 */
    this.form96333Data={
      disposeId:'',
      file:'',
      type:''
    }
      this.file96333List=[]
      this.import96333Visible=false
    },

    uploadCheckClick(){/**上传点击事件 */
    this.importCheckVisible=true
    },
    changeCheckUploadFile(file,fileList){
      for(let i=0;i<fileList.length;i+=1){
        this.fileCheckList.push(fileList[i].raw)
      }
    },
    importCheckOK(){/**导入确定 */
    this.fullscreenCheckLoading = true;
      let param = new FormData()
      param.append('file', this.fileCheckList[0])
      util.http.post(this.$util.baseIP+'/biz-maint/maint-admin/eleInfo/import-ele-check',param,{
        headers: {
          'Content-Type': 'multipart/form-data'
        },
        transformRequest: [
          function (d) {
            console.log(d)
            return d
          }
        ]
      }).then(res=>{

        this.fullscreenCheckLoading = false;

        this.formCheckData={
          disposeId:'',
          file:'',
          type:''
        }
        this.fileCheckList=[]
        this.importCheckVisible=false
        if(res.data.data.length>0){
          const params = {
            title: ['设备代码',"错误信息"],
            key: ['eleCode',  'remark'],
            data: res.data.data, // 数据源
            autoWidth: true, //autoWidth等于true，那么列的宽度会适应那一列最长的值
            filename: '错误列表'
          }
          excel.exportArrayToExcel(params)
        }
        this.gettableData()
      })
    },
    importCheckCancel(){/**导入取消 */
    this.formCheckData={
      disposeId:'',
      file:'',
      type:''
    }
      this.fileCheckList=[]
      this.importCheckVisible=false
    },

    onexport () {
      const query = {
        maintOrgId:this.maintOrgId,
        manageOrgId: this.form.manageOrgId,
        factoryNo: this.form.factoryNo,
        manageAreaOrgId: this.form.manageAreaOrgId,
        eleCode: this.form.eleCode,
        num96333: this.form.num96333,
        useOrgName: this.form.useOrgName,
        maintOrgName:this.form.maintOrgName,
        pageNum: 1,
        pageSize: 100000,
        eleAreaCode: this.form.eleAreaCode,
        county: this.form.county,
      }
      getAdminPublicEleList(query).then(res => {
        if (res.data.code == 200) {
          let tableData = res.data.data.list
          for(let i=0;i<tableData.length;i++){
            tableData[i].eleUseCommunity=tableData[i].eleUseCommunity.replace("-"+tableData[i].eleUseInnerno,"")
            tableData[i].hasUnder=this.isOverdueArr[tableData[i].hasUnder]
          }
          const params = {
            title: ['序号','设备注册代码','识别码','登记证号', '管理机构', '注册登记机构名称','电梯类型',"使用单位",
              "维保单位","制造商","出厂编号","检验机构名称","下次检验日期","所属区域代码","电梯安装地址","楼栋内部编号","地理信息(经纬度)",
              "电梯状态","是否有地下室","开始楼层","最高楼层"],
            key: ['index','eleCode','num963333', 'eleCertNo', 'manageOrgName','regOrgName','typeName',"useOrgName",
              "maintOrgName","manufacturerName","factoryNo","checkOrgName","eleNextChecktime","eleAreaCode","eleUseCommunity","eleUseInnerno","eleLocation",
              "eleStatus","hasUnder","startFloor","endFloor"],
            data: tableData, // 数据源
            autoWidth: true, //autoWidth等于true，那么列的宽度会适应那一列最长的值
            filename: '电梯列表'
          }
          excel.exportArrayToExcel(params)
        }
      })
    },
    getTotals () {
      const query = {
        maintOrgId:this.maintOrgId,
        factoryNo: this.form.factoryNo,
        manageOrgId: this.form.manageOrgId,
        manageAreaOrgId: this.form.manageAreaOrgId,
        eleCode: this.form.eleCode,
        num96333: this.form.num96333,
        useOrgName: this.form.useOrgName,
        maintOrgName:this.form.maintOrgName,
        pageNum: this.pagination.pageNum,
        pageSize: this.pagination.pageSize,
        eleAreaCode: this.form.eleAreaCode,
        county: this.form.county,
      }
      getAdminPublicEleTotal(query).then(res => {
        if (res.data.code == '200') {
          console.log(res)
          this.obj = res.data.data
        }
      })
    },
    areaChange(){
      this.form.manageOrgId=''
      this.getManangeOrgList()
    },
    getManangeOrgList () {

      const param={manageAreaOrgId: this.form.manageAreaOrgId};
      getAdminManageOrgInfoList(param).then(res => {
        if (res.data.code == 200) {
          this.manangeOrgList = res.data.data
        }
        this.selectShow = true;
      })
    },
    getManangeAreaOrgList () {
      const param={};
      getAdminManageAreaOrgInfoList(param).then(res => {
        if (res.data.code == 200) {
          this.manangeAreaOrgList = res.data.data
        }
        this.selectShow = true;
      })
    },
    eleManage () {
      if (this.multipleSelection.length > 0) {
        this.dialogVisible = true

      } else {
        this.$message({
          type: 'info',
          message: '请选择电梯'
        })
      }
    },
    getXiugai(){
      this.$confirm('是否确认修改管理单位?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        let query = this.multipleSelection.map((item) => {
          return item.eleCode
        })
        const params = {
          eleCodeList: query,
          manageOrgId:this.orgForm.manageOrgId
        }
        editEleListManageOrg(params).then(res => {
          if (res.data.code == '200') {
            this.dialogVisible = false
            this.gettableData()
            this.$message({
              type: 'success',
              message: '修改成功!'
            })
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消'
        })
      })
    },
    getUseOrgList (query) {
      const param={orgType:1,pageNum:1,pageSize:100, orgName:query};
      getadminOrgInfoListNew(param).then(res => {
        if (res.data.code == 200) {
          this.useOrgList = res.data.data
        }
        this.plxgShow = true;
      })
    },
    getMaintOrgList (query) {
      console.log("getMaintOrgList",query);
      const param = {orgType:0,
        pageSize:100,
        pageNum:1,
        orgName:query
      };
      //获取数据
      getadminOrgInfoListNew(param).then(res => {
        if (res.data.code == 200) {
          this.maintOrgList = res.data.data
        }
        this.plxgShow = true;
      })
    },
    eleEdit () {
      if (this.multipleSelection.length > 0) {
        this.eledialogVisible = true

      } else {
        this.$message({
          type: 'info',
          message: '请选择电梯'
        })
      }
    },
    xiugaiEle(){
      this.$confirm('是否确认修改电梯信息?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        let query = this.multipleSelection.map((item) => {
          return item.eleCode
        })
        const params = {
          eleCodeList: query,
          useOrgId:this.eleForm.useOrgId,
          maintOrgId:this.eleForm.maintOrgId,
          eleLocation:this.eleForm.eleLocation
        }
        this.editfullscreenLoading=true;
        editEleByCodes(params).then(res => {
          this.editfullscreenLoading=false;
          if (res.data.code == '200') {
            this.eledialogVisible = false
            this.gettableData()
            this.$message({
              type: 'success',
              message: '修改成功!'
            })
          }else{
            this.$message({
              type: 'error',
              message: res.data.msg
            })
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消'
        })
      })
    },
    showData (code) {
      this.eleAreaCode=code
      this.gettableData();
    },
    // 获取公共电梯池数据
    gettableData () {
      this.getTotals()
      const query = {
        maintOrgId:this.maintOrgId,
        manageOrgId: this.form.manageOrgId,
        factoryNo: this.form.factoryNo,
        manageAreaOrgId: this.form.manageAreaOrgId,
        eleCode: this.form.eleCode,
        num96333: this.form.num96333,
        useOrgName: this.form.useOrgName,
        maintOrgName:this.form.maintOrgName,
        pageNum: this.pagination.pageNum,
        pageSize: this.pagination.pageSize,
        eleAreaCode: this.form.eleAreaCode,
        county: this.form.county,
      }
      getAdminPublicEleList(query).then(res => {
        if (res.data.code == 200) {
          this.tableData = res.data.data.list
          this.pagination.pageTotal = res.data.data.total
          this.maintEleTotal=res.data.data.total
        }
      })
    },
    infoClick (eleCode) {
      this.$refs.LeftDetails.dialogVisible1 = true
      this.$refs.LeftDetails.eleCode = eleCode
      this.$refs.LeftDetails.getPageData()
    },
    handleSelectionChange (val) {
      this.multipleSelection = val
    },
    handleSizeChange (val) {
      this.pagination.pageNum = 1
      this.pagination.pageSize = val
      this.gettableData()
    },
    handleCurrentChange (val) {
      this.pagination.pageNum = val
      this.gettableData()
    },

    editClick (e) {
      this.$refs.dailog.dialogVisible = true
      this.$refs.dailog.title = '修改'
      this.$refs.dailog.disable = false
      const params = JSON.parse(JSON.stringify(e))

      this.$refs.dailog.getEleInfo(params.id)
    },
    addClick () {
      this.$refs.dailog.dialogVisible = true
      this.$refs.dailog.title = '添加'
      this.$refs.dailog.disable = false
    },
  }
}

</script>
<style>

.boxstyle {

  .el-loading-text,.el-loading-spinner,.el-loading-spinner i {
    color:#fff;
    font-size: 40px;
    margin-top: -10px;
  }
}

</style>
<style lang="less" scoped>


.el-pagination {
  margin-top: 5px;
  text-align: right;
}

.number {
  color: red;
}

.card1 {
  ::v-deep .el-input__inner {
    width: 180px;
  }
  ::v-deep .el-form-item__label {
    font-weight: 800;
  }
}
.clearfix {
  font-weight: 800;
}

::v-deep .el-card__body {
  padding: 10px;
}
.active{
  background: #8cf1f6;
}

.card3 {
  margin-top: 15px;
  .text {
    ::v-deep .el-table--scrollable-x .el-table__body-wrapper {
      z-index: 2;
    }
    ::v-deep .el-table__fixed::before {
      height: 0px;
    }
  }
}
</style>
